<template>
  <el-dialog :title="`${form.mrqId ? '修改' : '添加'}实测实量`" :visible.sync="show" :close-on-click-modal="false" :show-close="!btnLoading" width="600px" @closed="$refs.form.resetFields()">
    <el-form ref="form" :model="form" :rules="rules">
      <el-form-item prop="standardId" class="hide" />
      <el-form-item prop="mrqId" class="hide" />
      <el-form-item label="实测实量检查内容" prop="mrqName"><el-input v-model.trim="form.mrqName" type="textarea" :rows="2" placeholder="请输入实测实量检查内容" :maxlength="1000" /></el-form-item>
      <el-form-item label="评判标准" prop="mrqStandard"><el-input v-model.trim="form.mrqStandard" type="textarea" :rows="2" placeholder="请输入评判标准" :maxlength="3000" /></el-form-item>
      <el-form-item label="选点规则、测量方法" prop="mrqRule"><el-input v-model.trim="form.mrqRule" type="textarea" :rows="6" placeholder="请输入选点规则、测量方法" :maxlength="3000" /></el-form-item>
      <el-form-item label="要求测点" prop="requiredCheck" style="display: flex"><el-input-number v-model="form.requiredCheck" :min="0" :max="1e8" :precision="0" controls-position="right" /></el-form-item>
    </el-form>
    <div slot="footer">
      <el-button type="primary" :loading="btnLoading" @click="btnSubmit">确 定</el-button>
      <el-button :disabled="btnLoading" @click="show = false">取 消</el-button>
    </div>
  </el-dialog>
</template>
<script>
// 添加或修改实测实量对话框
import { editFormMixin } from '@/utils/mixin'
import { addCheckMrq, updateCheckMrq } from '@/api/qualityManage/cq'
export default {
  mixins: [editFormMixin],
  data() {
    return {
      primaryKey: 'mrqId',
      addApi: addCheckMrq,
      updateApi: updateCheckMrq,
      form: {
        standardId: '',
        mrqId: '',
        mrqName: '',
        mrqStandard: '',
        mrqRule: '',
        requiredCheck: 0
      },
      rules: {
        mrqName: [{ required: true, message: '请输入实测实量检查内容' }],
        mrqStandard: [{ required: true, message: '请输入评判标准' }],
        mrqRule: [{ required: true, message: '请输入选点规则、测量方法' }]
      }
    }
  }
}
</script>
